module.exports = function(grunt) {

	// Project configuration.
	// HTML压缩
	
		
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),

		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
			},
			build: {
				src: 'js/*',
				dest: 'dist/core.min.js',
			}
		},
		//编译less
		less: {
			task: {
				src: 'less/core.less',
				dest: 'dist/core.css',
			}
		},
		
		// CSS语法错误检查
		csslint: {
			task: {
				options: {
					"adjoining-classes": false,
					"box-sizing": false,
					"box-model": false,
					"compatible-vendor-prefixes": false,
					"floats": false,
					"font-sizes": false,
					"gradients": false,
					"important": false,
					"known-properties": false,
					"outline-none": false,
					"qualified-headings": false,
					"regex-selectors": false,
					"shorthand": false,
					"text-indent": false,
					"unique-headings": false,
					"universal-selector": false,
					"unqualified-attributes": false
				},
				src: 'dist/core.css'
			}
		},
		
		// CSS压缩
		cssmin: {
			task: {
				
				src: 'dist/core.css',
				dest: 'dist/core.min.css',
			}
		},
		
		// 合并所有的js
		concat: {
			task: {
				
				src: 'js/*.js',
				dest: 'dist/core.js'
			}
		},
		
		
		
		// 动态监听文件的更改并执行相应的任务
		watch:{
			files:['js/*.js','less/*.less'],
			tasks:['htmlmin','uglify', 'less','csslint','cssmin','concat','jshint'],
		}
	});
	
	// 加载包含 "uglify" 任务的插件。
	
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-contrib-csslint');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-concat');

	
	// 默认被执行的任务列表。
	grunt.registerTask('default', ['uglify', 'less','csslint','cssmin','concat']);

};